PHP : Hide PHP version information from curl
By default, PHP will expose its version information when query by curl -I
and you may want to hide the version information to prevent a potential attacker from gaining more information.
For example:
localhost:~ admin$ curl -I https://www.socketloop.com
HTTP/1.1 200 OK
Server: nginx/1.4.6
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.25
<------ hereAccess-Control-Allow-Credentials: true
Date: Thu, 14 Aug 2014 12:21:40 GMT
Cache-Control: max-age=0, no-cache
To turn off the version information. Do the following on the webserver's PHP configuration :
vi /etc/php.ini
look for expose_php = On
line
change it to expose_php = Off
and this will cause PHP not to send over the version information when queried.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+55.4k Golang : Unmarshal JSON from http response
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+6.6k Golang : Map within a map example
+5.9k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+10.2k Golang : Compare files modify date example
+17.1k Golang : Covert map/slice/array to JSON or XML format
+20.8k Golang : Read directory content with os.Open
+6.1k nginx : force all pages to be SSL
+16.2k Golang : How to check if input from os.Args is integer?
+11.3k Golang : Calculate Relative Strength Index(RSI) example
+4.7k Javascript : Detect when console is activated and do something about it
+9.8k Golang : Qt get screen resolution and display on center example